<template>
  <div style="width: 100%; height: 100%;">
    <!--    <img src="./assets/logo.png">-->
    <router-view/>
  </div>
</template>

<script>
export default {
  name: 'App',
  methods: {
    checkLogin: function () {
      const user = this.$global.getUser()
      if (user === null || user === "{}" || user.sessionId === null || user.sessionId === "") {
        this.$router.push({
          path: '/login'
        })
      } else {
        if (this.$global.getTabIndex() === null) {
          this.$global.setTabIndex(1)
          this.$router.push({
            path: '/homePage'
          })
        }else if (this.$global.getTabIndex() === 1) {
          this.$router.push({
            path: '/homePage'
          })
        }
      }
    },
    isMobile: function(){
      return navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
    }
  },
  created() {
    //this.checkLogin()
  },
  mounted() {
    if (this.isMobile()) {
      this.$router.push({
        path: '/mobile'
      })
    } else {
      this.checkLogin()
    }
  }
}
</script>

<style>

</style>
